from appium.webdriver.common.mobileby import MobileBy

from common.baseactivity import BaseActivity
from activity.IdentificationActivity import IdentificationActivity
from appium.webdriver.common.touch_action import TouchAction

class LoginActivity(BaseActivity):

    def __init__(self):
        super().__init__()
        self.login_nums = [(MobileBy.ANDROID_UIAUTOMATOR,'text("%s")'%_) for _ in [2,5,8,3,6,9]]

    def login(self):

        for num in self.login_nums:
            self.ele_click(num)

    def to_factoty(self):
        num0 = (MobileBy.ANDROID_UIAUTOMATOR,'text("0")')
        TouchAction(self.driver).long_press(self.ele_locator(num0)).release().perform()
        self.driver.press_keycode(3) #按HOME键

if __name__ == '__main__':

    IdentificationActivity().loginLogo()
    #LoginActivity().login()
    LoginActivity().to_factoty()